Telegram Group & Telegram Channel
48. Create & Display Matrix.

import java.util.Scanner;

class Matrix_Create {

Scanner scan;
int matrix[][];
int row, column;

void create() {

scan = new Scanner(System.in);

System.out.println("Matrix Creation");

System.out.println("\nEnter number of rows :");
row = Integer.parseInt(scan.nextLine());

System.out.println("Enter number of columns :");
column = Integer.parseInt(scan.nextLine());

matrix = new int[row][column];
System.out.println("Enter the data :");

for(int i=0; i<row ; i++) {

for(int j=0; j
<column ; j++) {

matrix[i][j] =scan.nextInt();
}
}
}

void display() {

System.out.println("\nThe Matrix is :");

for(int i=0; i <row ; i++) {

for(int j=0; j <column ; j++) {

System.out.print("\t" + matrix[i][j]);
}
System.out.println();
}
}
}

class CreateAndDisplayMatrix {

public static void main(String
args[]) {

Matrix_Create obj=new Matrix_Create();

obj.create();
obj.display();
}
}

@java_codings



tg-me.com/java_codings/68
Create:
Last Update:

48. Create & Display Matrix.

import java.util.Scanner;

class Matrix_Create {

Scanner scan;
int matrix[][];
int row, column;

void create() {

scan = new Scanner(System.in);

System.out.println("Matrix Creation");

System.out.println("\nEnter number of rows :");
row = Integer.parseInt(scan.nextLine());

System.out.println("Enter number of columns :");
column = Integer.parseInt(scan.nextLine());

matrix = new int[row][column];
System.out.println("Enter the data :");

for(int i=0; i<row ; i++) {

for(int j=0; j
<column ; j++) {

matrix[i][j] =scan.nextInt();
}
}
}

void display() {

System.out.println("\nThe Matrix is :");

for(int i=0; i <row ; i++) {

for(int j=0; j <column ; j++) {

System.out.print("\t" + matrix[i][j]);
}
System.out.println();
}
}
}

class CreateAndDisplayMatrix {

public static void main(String
args[]) {

Matrix_Create obj=new Matrix_Create();

obj.create();
obj.display();
}
}

@java_codings

BY Advance Java πŸ‘¨β€πŸ’»


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/java_codings/68

View MORE
Open in Telegram


Advance Java ‍ Telegram | DID YOU KNOW?

Date: |

Tata Power whose core business is to generate, transmit and distribute electricity has made no money to investors in the last one decade. That is a big blunder considering it is one of the largest power generation companies in the country. One of the reasons is the company's huge debt levels which stood at β‚Ή43,559 crore at the end of March 2021 compared to the company’s market capitalisation of β‚Ή44,447 crore.

Advance Java ‍ from it


Telegram Advance Java πŸ‘¨β€πŸ’»
FROM USA